<template>
  <div class="box-container">
    <el-card style="max-width: 1000px;margin:10px 0;height: 30px;padding-left: 20px">
      @我的
    </el-card>

    <el-card style="max-width: 1000px;min-height: 200px;padding: 20px">
      <div class="reply-item" v-for="item in mentionInfoList" :key="item.commentId">
        <div class="box">
          <div class="avatar">
            <img :src="item.publisherAvatar" :alt="item.publisherNickname" width="60px">
          </div>
          <div class="reply-info">
            <div class="reply-info-title">
              <span class="reply-nickname" @click="toSpace(item.publisherId)">{{item.publisherNickname}}</span>&nbsp;&nbsp;&nbsp;在评论中@了我
            </div>
<!--            <div class="reply-info-content">-->
<!--              {{item.content}}-->
<!--            </div>-->
            <div v-html="item.content"></div>
            <div class="reply-info-footer">
              <div class="datetime">{{item.createTime}}</div>
              <div class="replyIt">
                <el-icon><ChatRound /></el-icon>回复
              </div>
            </div>
          </div>
          <div class="source-content" @click="toSourceComment(item.commentId,item.commentTypeId,item.sourceContentId)">
            <img width="100%"  :src="item.videoCover" alt="">
          </div>
<!--          <div class="source-video">-->
<!--            -->
<!--&lt;!&ndash;            <img :src="item.sourceVideoCover" :title="item.sourceVideoTitle" height="60">&ndash;&gt;-->
<!--          </div>-->
        </div>
        <el-divider />
      </div>

    </el-card>
  </div>
</template>
<script setup>
import {onMounted, ref} from "vue";
import {getAtMeComments} from "@/api/api.js";
import {useRouter} from "vue-router";


const mentionInfoList1 =  ref([
  {
    id:1,
    mentionImage:'/img/avatar2.webp',
    mentionNickname:'泡泡卡丁',
    mentionContent:'@甜九九',
    mentionTime:'2023年4月26日 20:44',
    sourceVideoId:1,
    sourceVideoImage:'/img/recommendVideoList/video01.png',
    sourceVideoTitle:'有手就会！'
  },{
    id:1,
    mentionImage:'/img/avatar2.webp',
    mentionNickname:'泡泡卡丁',
    mentionContent:'@甜九九',
    mentionTime:'2023年4月26日 20:44',
    sourceVideoId:1,
    sourceVideoImage:'/img/recommendVideoList/video01.png',
    sourceVideoTitle:'有手就会！'
  },{
    id:1,
    mentionImage:'/img/avatar2.webp',
    mentionNickname:'泡泡卡丁',
    mentionContent:'@甜九九',
    mentionTime:'2023年4月26日 20:44',
    sourceVideoId:1,
    sourceVideoImage:'/img/recommendVideoList/video01.png',
    sourceVideoTitle:'有手就会！'
  }
])


const mentionInfoList = ref([
  {
    commentId:1,
    publisherId:1,
    publisherAvatar:"/img/avatar2.webp",
    publisherNickname:"每天都要开心啊",
    content:"我很好。。。。。。。。。。。。。。",
    sourceContentId:1,
    targetCommentId:1,
    targetCommentContent:"你好吗csnadkcjnakjcankl才能打开cdacanjkcnaklcmadslcnalk差点就爱看",
    createTime:'2023年5月16日 16:55',
    commentTypeId:0
  }
])
const queryParams = {
  page:1,pageSize:10
}
onMounted(async  ()=>{
  const res = await getAtMeComments(queryParams)
  console.log(res)
  mentionInfoList.value = res.data.records
})

const router = useRouter();
const toSourceComment = (id,typeId,sourceContentId) => {
  console.log(typeof id)
  if(typeId === 1){
    router.push({
      name:"video",
      query:{
        videoId:sourceContentId,
        cId:id,
      }
    })
  }
  if(typeId === 2){
    router.push({
      path:"/dynamic",
      query:{
        dynamicId:sourceContentId,
        cId:id,
      }
    })
  }
  console.log("去原评论:"+id)
}

const toSpace = (id) => {
  router.push({
    name:"home",
    params:{
      id
    }
  })
}
</script>
<style lang="scss" scoped>

:deep(.el-card__body){
  padding: 0;
}

.box-container{
  box-sizing: border-box;
  height: 640px;
  //background-color: white;
}
.el-card{
  --el-card-padding:10px
}
.el-card .el-card__body{
  padding: 0;
}
.reply-item .box{
  display: flex;
  box-sizing: border-box;
  width: 100%;
  height: 100px;

  .avatar{
    box-sizing: border-box;
    //padding: 20px;
    width: 50px;
    height: 50px;
    overflow: hidden;
    border-radius: 25px;
    margin-right: 20px;
  }
  .reply-info{
    box-sizing: border-box;
    width: 750px;
    height: 30px;
    //background-color: black;
    .reply-info-title{
      height: 30px;
      .reply-nickname{
        color: black;
        font-weight: bold;
        cursor: pointer;
      }
    }
    .reply-info-content{
      height: 50px;
      color: gray;
    }
    .reply-info-footer{
      color: gray;
      font-size: 12px;
      display: flex;
      .datetime{
        width: 150px;
      }
      .replyIt{
        width: 60px;
      }

    }
  }
  .source-content{
    margin: 20px 0;
    width: 60px;
    height: 60px;
  }
}
.el-divider--horizontal{
  margin:15px 0;
}
</style>

<!--经典修改css变量值的方式控制css-->